package com.konne.nightmare.FastPublicOpinion.http;

import androidx.annotation.NonNull;

import com.konne.nightmare.FastPublicOpinion.utils.MMKVUtils;
import com.konne.nightmare.FastPublicOpinion.utils.Utils;
import com.socks.library.KLog;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;


public class AddHead implements Interceptor {


    @NonNull
    @Override
    public Response intercept(Chain chain) throws IOException {
        Request original = chain.request();
        Request.Builder requestBuilder = original.newBuilder()
                .header("Content-Type", "application/json; charset=UTF-8")
                .addHeader("Connection", "close")
                .addHeader("Authorization", MMKVUtils.getMMKVString(Utils.TOKEN));
        Request request = requestBuilder.build();
        KLog.d(Utils.TAG, MMKVUtils.getMMKVString(Utils.TOKEN));
        return chain.proceed(request);
    }


}
